<?

/**
 * My code
 */
class redis_myredis extends redis_peer
{
    /**
     * 
     * @var redis_redis
     */
    private static $conn;
    
    public function __construct() {
        $listServer = array(
            'master' => array('192.168.56.101', 6379),
        );
        redis_pool::add_servers($listServer);
        
        parent::__construct();
        
        if (!self::$conn) {
            self::$conn = $this->get_connection();
        }
    }
    
    public function insert($key, $data) {
        return self::$conn->set($key, $data);
    }
    
    public function fetch($key) {
        return self::$conn->get($key);
    }
    
    public function delete($key) {
        return self::$conn->delete($key);
    }
    
    public function publish($channel, $message)
    {
        return self::$conn->publish($channel, $message);
    }
    
    public function subscribe($channel)
    {
        return self::$conn->subscribe($channel);
    }
}